<<<<<<< HEAD
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 活动管理
 * @author viviqin
 *
 */
class Activity extends CI_Controller {
	
	private $tab = 'shop';
	
	function __construct(){
		parent::__construct();
		/** 登陆验证 */
		if(!isset($_SESSION)){
		    session_start();
		}
		$admin = $this->session->userdata('admin_user');
		if(!$admin || !isset($admin['user_id'])){
			header('Location: /sys_admin/login');
			exit;
		}
	}
	
	/**
	 * 许愿树列表
	 * @author viviqin
	 */
	function treelist(){
		$per_page 	= $this->input->get('per_page')?$this->input->get('per_page'):0;
		$this->load->model('Tree_model');
		$data['page_size']  = sys_admin_LIST_PAGE_SIZE;
		$data['page_start'] = (int)$per_page;
		$vdata = $this->Tree_model->get_list($data);
		$this->load->library('pagination');
		$config['base_url'] = '/sys_admin/activity/treelist/?';
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = sys_admin_LIST_PAGE_SIZE; 
		$this->pagination->initialize($config);
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'tree';
		
		$this->load->view('/sys_admin/site/activity_tree_list', $vdata);
	}
	
	/**
	 *  屏蔽许愿树
	 * @author viviqin
	 */
	function tree_shielding(){
		$this->load->model('Tree_model');
		$id = $this->input->post('id');
		$data = array('status'=>1);
		$ret = $this->Tree_model->update($id,$data);
		if($ret>0){
			$this->mycache->delete('tree_wish_key');
			echo 'ok';
			exit;
		}
		echo 'fail';
		exit;
	}
	
	/**
	 * 年会列表
	 * @author viviqin
	 */
	function nianhuilist(){
		$per_page 	= $this->input->get('per_page')?$this->input->get('per_page'):0;
		$this->load->model('Tree_model');
		$data['page_size']  = sys_admin_LIST_PAGE_SIZE;
		$data['page_start'] = (int)$per_page;
		$vdata = $this->Tree_model->get_nianhui_list($data);
		$this->load->library('pagination');
		$config['base_url'] = '/sys_admin/activity/nianhuilist/?';
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = sys_admin_LIST_PAGE_SIZE; 
		$this->pagination->initialize($config);
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'year';
		
		$this->load->view('/sys_admin/site/activity_nianhui_list', $vdata);
	}
	
	/**
	 *  屏蔽年会内容
	 * @author viviqin
	 */
	function nianhui_shielding(){
		$this->load->model('Tree_model');
		$id = $this->input->post('id');
		$data = array('status'=>1);
		$ret = $this->Tree_model->update_nianhui($id,$data);
		if($ret>0){
			$this->mycache->delete('tree_wish_key');
			echo 'ok';
			exit;
		}
		echo 'fail';
		exit;
	}
	
	/**
	 * reg100列表
	 * @author viviqin
	 */
	function reglist(){
		$per_page 	= $this->input->get('per_page')?$this->input->get('per_page'):0;
		$this->load->model('Tree_model');
		$data['page_size']  = sys_admin_LIST_PAGE_SIZE;
		$data['page_start'] = (int)$per_page;
		$vdata = $this->Tree_model->get_reg_list($data);
		$this->load->library('pagination');
		$config['base_url'] = '/sys_admin/activity/reglist/?';
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = sys_admin_LIST_PAGE_SIZE; 
		$this->pagination->initialize($config);
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'reg';
		
		$this->load->view('/sys_admin/site/activity_reg100_list', $vdata);
	}
	
	/**
	 *  屏蔽reg100留言
	 * @author viviqin
	 */
	function reg_shielding(){
		$this->load->model('Tree_model');
		$id = $this->input->post('id');
		$data = array('status'=>1);
		$ret = $this->Tree_model->update_reg($id,$data);
		if($ret>0){
			$reg_list = $this->mycache->get_array('reg_message_key');
			foreach($reg_list as $k=>$v){
			    if($v['id']==$id){
			        unset($reg_list[$k]);
			    }
			}
			$this->mycache->set_array('reg_message_key',$reg_list);
			echo 'ok';
			exit;
		}
		echo 'fail';
		exit;
	}
	
	function activitylist(){
		$this->load->model('Tree_model');
		$type 				= $this->input->get('type');
		
		if($type != 0){
			$data['type'] = $type;
		}
		
		$per_page 	= $this->input->get('per_page')?$this->input->get('per_page'):0;
		$data['page_size']  = sys_admin_LIST_PAGE_SIZE;
		$data['page_start'] = (int)$per_page;
		$vdata = $this->Tree_model->get_activity_list($data);
		$this->load->library('pagination');
		$config['base_url'] = '/sys_admin/activity/activitylist/?';
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = sys_admin_LIST_PAGE_SIZE; 
		$this->pagination->initialize($config);
		$vdata['type_array'] = array(1=>'爬楼');
		$vdata['type'] 		= $type;
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'activity_list';
		
		$this->load->view('/sys_admin/site/activity_list', $vdata);
	}
	
	function activity_shielding(){
		$this->load->model('Tree_model');
		$id = $this->input->post('id');
		$type = $this->input->post('type');
		$data = array('status'=>1);
		$ret = $this->Tree_model->update_activity($id,$data);
		if($ret>0){
			if($type == 1){
				$key = 'palou_message_key';
			}else{
				$key = 'comment_message_key_'.$type;
			}
			
			$activity_list = $this->mycache->get_array($key);
			foreach($activity_list as $k=>$v){
			    if($v['id']==$id){
			        unset($activity_list[$k]);
			    }
			}
			$this->mycache->set_array($key,$activity_list);
			echo 'ok';
			exit;
		}
		echo 'fail';
		exit;
	}
=======
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 活动管理
 * @author viviqin
 *
 */
class Activity extends CI_Controller {
    
	private $tab = 'shop';
	
	function __construct(){
		parent::__construct();
		/** 登陆验证 */
		if(!isset($_SESSION)){
		    session_start();
		}
		$admin = $this->session->userdata('admin_user');
		if(!$admin || !isset($admin['user_id'])){
			header('Location: /sys_admin/login');
			exit;
		}
	}
	
	/**
	 * 许愿树列表
	 * @author viviqin
	 */
	function treelist(){
		$per_page 	= $this->input->get('per_page')?$this->input->get('per_page'):0;
		$this->load->model('Tree_model');
		$data['page_size']  = sys_admin_LIST_PAGE_SIZE;
		$data['page_start'] = (int)$per_page;
		$vdata = $this->Tree_model->get_list($data);
		$this->load->library('pagination');
		$config['base_url'] = '/sys_admin/activity/treelist/?';
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = sys_admin_LIST_PAGE_SIZE; 
		$this->pagination->initialize($config);
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'tree';
		
		$this->load->view('/sys_admin/site/activity_tree_list', $vdata);
	}
	
	/**
	 *  屏蔽许愿树
	 * @author viviqin
	 */
	function tree_shielding(){
		$this->load->model('Tree_model');
		$id = $this->input->post('id');
		$data = array('status'=>1);
		$ret = $this->Tree_model->update($id,$data);
		if($ret>0){
			$this->mycache->delete('tree_wish_key');
			echo 'ok';
			exit;
		}
		echo 'fail';
		exit;
	}
	
	/**
	 * 年会列表
	 * @author viviqin
	 */
	function nianhuilist(){
		$per_page 	= $this->input->get('per_page')?$this->input->get('per_page'):0;
		$this->load->model('Tree_model');
		$data['page_size']  = sys_admin_LIST_PAGE_SIZE;
		$data['page_start'] = (int)$per_page;
		$vdata = $this->Tree_model->get_nianhui_list($data);
		$this->load->library('pagination');
		$config['base_url'] = '/sys_admin/activity/nianhuilist/?';
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = sys_admin_LIST_PAGE_SIZE; 
		$this->pagination->initialize($config);
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'year';
		
		$this->load->view('/sys_admin/site/activity_nianhui_list', $vdata);
	}
	
	/**
	 *  屏蔽年会内容
	 * @author viviqin
	 */
	function nianhui_shielding(){
		$this->load->model('Tree_model');
		$id = $this->input->post('id');
		$data = array('status'=>1);
		$ret = $this->Tree_model->update_nianhui($id,$data);
		if($ret>0){
			$this->mycache->delete('tree_wish_key');
			echo 'ok';
			exit;
		}
		echo 'fail';
		exit;
	}
	
	/**
	 * reg100列表
	 * @author viviqin
	 */
	function reglist(){
		$per_page 	= $this->input->get('per_page')?$this->input->get('per_page'):0;
		$this->load->model('Tree_model');
		$data['page_size']  = sys_admin_LIST_PAGE_SIZE;
		$data['page_start'] = (int)$per_page;
		$vdata = $this->Tree_model->get_reg_list($data);
		$this->load->library('pagination');
		$config['base_url'] = '/sys_admin/activity/reglist/?';
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = sys_admin_LIST_PAGE_SIZE; 
		$this->pagination->initialize($config);
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'reg';
		
		$this->load->view('/sys_admin/site/activity_reg100_list', $vdata);
	}
	
	/**
	 *  屏蔽reg100留言
	 * @author viviqin
	 */
	function reg_shielding(){
		$this->load->model('Tree_model');
		$id = $this->input->post('id');
		$data = array('status'=>1);
		$ret = $this->Tree_model->update_reg($id,$data);
		if($ret>0){
			$reg_list = $this->mycache->get_array('reg_message_key');
			foreach($reg_list as $k=>$v){
			    if($v['id']==$id){
			        unset($reg_list[$k]);
			    }
			}
			$this->mycache->set_array('reg_message_key',$reg_list);
			echo 'ok';
			exit;
		}
		echo 'fail';
		exit;
	}
	
	function activitylist(){
		$this->load->model('Tree_model');
		$type 				= $this->input->get('type');
		
		if($type != 0){
			$data['type'] = $type;
		}
		
		$per_page 	= $this->input->get('per_page')?$this->input->get('per_page'):0;
		$data['page_size']  = sys_admin_LIST_PAGE_SIZE;
		$data['page_start'] = (int)$per_page;
		$vdata = $this->Tree_model->get_activity_list($data);
		$this->load->library('pagination');
		$config['base_url'] = '/sys_admin/activity/activitylist/?';
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = sys_admin_LIST_PAGE_SIZE; 
		$this->pagination->initialize($config);
		$vdata['type_array'] = array(1=>'爬楼');
		$vdata['type'] 		= $type;
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'activity_list';
		
		$this->load->view('/sys_admin/site/activity_list', $vdata);
	}
	
	function activity_shielding(){
		$this->load->model('Tree_model');
		$id = $this->input->post('id');
		$type = $this->input->post('type');
		$data = array('status'=>1);
		$ret = $this->Tree_model->update_activity($id,$data);
		if($ret>0){
			if($type == 1){
				$key = 'palou_message_key';
			}else{
				$key = 'comment_message_key_'.$type;
			}
			
			$activity_list = $this->mycache->get_array($key);
			foreach($activity_list as $k=>$v){
			    if($v['id']==$id){
			        unset($activity_list[$k]);
			    }
			}
			$this->mycache->set_array($key,$activity_list);
			echo 'ok';
			exit;
		}
		echo 'fail';
		exit;
	}
>>>>>>> d47623b610d79a4eeb489500830c00d70933f414
}